<!DOCTYPE html>
<html xmlns:shiro="http://www.thymeleaf.org/thymeleaf-extras-shiro" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>主页-桂电请假系统</title>
    <link href="css/index.css" rel="stylesheet" type="text/css"/>
    <script src="tools/jquery-3.6.0.min.js"></script>
</head>
<body>
<!-- 确保没有问题 -->
<script type="module">
    import './xy-ui/index.js';
</script>

<xy-layout class="layout">
    <xy-layout class="header">
        <span class="header-title">
            桂电请假系统
        </span>
        <span>
            <span class="now-user" th:text="'欢迎你，'+${#session.getAttribute('id')}"></span>
            <span shiro:hasRole="admin">[管理员]</span>
            <span shiro:hasRole="student">[学生]</span>
            <span shiro:hasRole="teacher">[教师]</span>
            <span shiro:hasRole="counselor">[辅导员]</span>
            <xy-button href="/logout" type="danger">登出</xy-button>
        </span>

    </xy-layout>
    <xy-layout expand row>
        <xy-layout class="side">

            <ul class="tx-nav">
                <!-- 有学生角色时显示学生自助服务-->
                <!--                <li shiro:hasRole="student">-->
                <li shiro:hasRole="student">
                    <div>学生自助服务</div>
                    <ul>
                        <li shiro:hasPermission="/student/apply"><a href="student/apply" target="mainFrame">请假</a></li>
                        <li shiro:hasPermission="/student/cancel"><a href="/student/cancel" target="mainFrame">销假</a>
                        </li>
                        <li shiro:hasPermission="/student/look"><a href="/student/look" target="mainFrame">查看进度</a></li>
                        <li shiro:hasPermission="/student/record"><a href="/student/record" target="mainFrame">请假记录</a>
                        </li>
                    </ul>
                </li>
                <!-- 没有学生角色时显示审批-->
                <li shiro:hasAnyRoles="teacher,counselor">
                    <div>审批</div>
                    <ul>
                        <li shiro:hasAnyRoles="teacher,admin"><a href="/teacher/approve" target="mainFrame">任课教师审批</a>
                        </li>
                        <li shiro:hasAnyRoles="counselor,admin"><a href="/counselor/approve"
                                                                   target="mainFrame">辅导员审批</a></li>
                    </ul>
                </li>

                <li shiro:hasRole="admin">
                    <div>数据观星</div>
                    <ul>
                        <li><a href="/leave/dataAll" target="mainFrame">主数据</a></li>
                    </ul>
                </li>

            </ul>

            <!--加个管理员角色 没有数据是因为我们的数据基本都是根据当前登录用户来的-->

        </xy-layout>
        <xy-layout center class="main" expand>
            <xy-layout center class="box">
                <!--给iframe加个name，方便我们的页面跳转进来-->
                <iframe frameborder="0" height="100%" id="mainFrame" name="mainFrame" src="main.html"
                        width="100%"></iframe>
            </xy-layout>
        </xy-layout>
    </xy-layout>
    <xy-layout class="footer">Copyright&copy;GUET-BTEAM-2021</xy-layout>

</xy-layout>

<script src="js/index.js" type="text/javascript"></script>

</body>
</html>
